home *** CD-ROM | disk | FTP | other *** search
/ Gekkan Dennou Club 142 / Gekkan Dennou Club - 2000.3 Vol. 142 (Japan).7z / Gekkan Dennou Club - 2000.3 Vol. 142 (Japan) (Track 1).bin / tools / s_tool / jxscan.c < prev    next >
Text File  |  1999-06-01  |  1KB  |  78 lines

  1. #include    <TNB.H>
  2.  
  3. #define    BUSYS(MM)    while( (MM)==8 )
  4.  
  5. int    main()
  6. {
  7. int    i,j,m,n,id,l,oid,d,jx;
  8. UNchar    buf[128];
  9. UNchar    *s;
  10. printf("X68k JX SCANNER CONNECT CHECKER Version 0.00 Copyright 1998 TNB製作所\n");
  11. l=(TWOSCHK()==-2)?15:7;
  12. for(d=0;d<=l;d++){
  13.     id=d;
  14.     //---- inquiry チェック
  15.     BUSYS( i=_scsi_inquiry(36,id,buf) );
  16.     if ( i<0 )
  17.         continue;
  18.     if ( i!=0 ){
  19.         //printf("inquiryでエラー(%d)\n",i);
  20.         if ( i==2 ){
  21.             //---- dummy 発行
  22.             BUSYS( i=_scsi_request( 22,id,buf) );
  23.         }
  24.         continue;
  25.     }
  26.     if ( buf[0]!=0x06 )
  27.         continue;
  28.     if ( strncmp(&buf[8],"SHARP",5)!=0 )
  29.         continue;
  30.     jx=999;
  31.     if ( strncmp(&buf[16],"JX250",5)==0 ){
  32.         jx=250;
  33.         s="250";
  34.     } elif ( strncmp(&buf[16],"JX350",5)==0 ){
  35.         jx=350;
  36.         s="350";
  37.     } elif ( strncmp(&buf[16],"JX270",5)==0 ){
  38.         jx=270;
  39.         s="270";
  40.     } elif ( strncmp(&buf[16],"JX330",5)==0 ){
  41.         jx=330;
  42.         s="330";
  43.     } elif ( strncmp(&buf[16],"JX325",5)==0 ){
  44.         jx=325;
  45.         s="325";
  46.     } elif ( strncmp(&buf[16],"JX-325",6)==0 ){
  47.         jx=325;
  48.         s="325";
  49.     }
  50.     if ( jx==999 )
  51.         continue;
  52.     //---- JXスキャナを発見
  53.     //---- dummy 発行
  54.     BUSYS( i=_scsi_request( 22,id,buf) );
  55.     printf("    JX-%s を ID %d に見つけました。\n",s,id);
  56.     return(jx);
  57. }
  58. printf("    ありませんでした。\n");
  59. return(-1);
  60. }
  61.  
  62. asm("
  63. _TWOSCHK:
  64.     move.l    #$001E,d1
  65.     moveq    #$f5,d0
  66.     trap    #15
  67.     rts
  68. _TW_CALL:
  69.     movem.l    d3-d4,-(sp)
  70.     move.l    4+8(sp),d1
  71.     move.l    8+8(sp),d4
  72.     moveq    #$f5,d0
  73.     trap    #15
  74.     movem.l    (sp)+,d3-d4
  75.     rts
  76.  
  77. ");
  78.